package com.gxp.system.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.gxp.common.annotation.Excel;
import com.gxp.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;
import java.util.List;

/**
 * 仪器对象 zk_instrument
 * 
 * @author zh
 * @date 2024-03-08
 */
public class ZkInstrument extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 主键 */
    private Long instId;

    /** HostId */
    private String hostId;

    /** 名称 */
    @Excel(name = "名称")
    private String instName;

    /** 生产商 */
    private String company;

    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date prodData;

    /** 型号 */
    @Excel(name = "型号")
    private String type;

    /** 样品总数 */
    @Excel(name = "样品总数")
    private Long sampleTotal;

    /** 状态（1：链接、2：离线） */
    @Excel(name = "状态", readConverterExp = "0=：启用、1：停用")
    private Long status;

    /** 温度 */
    @Excel(name = "温度")
    private String temperature;

    /** 转速 */
    @Excel(name = "转速")
    private String spin;

    /** 液氦剩余百分比 */
    @Excel(name = "He(%)")
    private String heLeave;

    /** 液氮剩余百分比 */
    @Excel(name = "N2(%)")
    private String nLeave;

    /** 公告 */
    private String notice;

    private Long isLock;

    private String approveBy;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date approveTime;

    private String approveType;

    private String approveDetail;

    private String comment;

    private List<ZkInstLog> instLogs;

    public void setInstId(Long instId) 
    {
        this.instId = instId;
    }

    public Long getInstId() 
    {
        return instId;
    }
    public void setHostId(String hostId) 
    {
        this.hostId = hostId;
    }

    public String getHostId() 
    {
        return hostId;
    }
    public void setInstName(String instName) 
    {
        this.instName = instName;
    }

    public String getInstName() 
    {
        return instName;
    }
    public void setCompany(String company) 
    {
        this.company = company;
    }

    public String getCompany() 
    {
        return company;
    }
    public void setType(String type) 
    {
        this.type = type;
    }

    public String getType() 
    {
        return type;
    }
    public void setSampleTotal(Long sampleTotal) 
    {
        this.sampleTotal = sampleTotal;
    }

    public Long getSampleTotal() 
    {
        return sampleTotal;
    }
    public void setStatus(Long status)
    {
        this.status = status;
    }

    public Long getStatus()
    {
        return status;
    }
    public void setTemperature(String temperature) 
    {
        this.temperature = temperature;
    }

    public String getTemperature() 
    {
        return temperature;
    }
    public void setSpin(String spin) 
    {
        this.spin = spin;
    }

    public String getSpin() 
    {
        return spin;
    }
    public void setHeLeave(String heLeave) 
    {
        this.heLeave = heLeave;
    }

    public String getHeLeave() 
    {
        return heLeave;
    }
    public void setnLeave(String nLeave) 
    {
        this.nLeave = nLeave;
    }

    public String getnLeave() 
    {
        return nLeave;
    }
    public void setNotice(String notice) 
    {
        this.notice = notice;
    }

    public String getNotice() 
    {
        return notice;
    }

    public List<ZkInstLog> getInstLogs() {
        return instLogs;
    }

    public void setInstLogs(List<ZkInstLog> instLogs) {
        this.instLogs = instLogs;
    }

    public Long getIsLock() {
        return isLock;
    }

    public void setIsLock(Long isLock) {
        this.isLock = isLock;
    }

    public String getApproveBy() {
        return approveBy;
    }

    public void setApproveBy(String approveBy) {
        this.approveBy = approveBy;
    }

    public Date getApproveTime() {
        return approveTime;
    }

    public void setApproveTime(Date approveTime) {
        this.approveTime = approveTime;
    }

    public String getApproveType() {
        return approveType;
    }

    public void setApproveType(String approveType) {
        this.approveType = approveType;
    }

    public String getApproveDetail() {
        return approveDetail;
    }

    public void setApproveDetail(String approveDetail) {
        this.approveDetail = approveDetail;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public Date getProdData() {
        return prodData;
    }

    public void setProdData(Date prodData) {
        this.prodData = prodData;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("instId", getInstId())
            .append("hostId", getHostId())
            .append("instName", getInstName())
            .append("company", getCompany())
            .append("prodData", getProdData())
            .append("createTime", getCreateTime())
            .append("type", getType())
            .append("sampleTotal", getSampleTotal())
            .append("status", getStatus())
            .append("temperature", getTemperature())
            .append("spin", getSpin())
            .append("heLeave", getHeLeave())
            .append("nLeave", getnLeave())
            .append("updateTime", getUpdateTime())
            .append("notice", getNotice())
            .toString();
    }

    @Override
    public String audit() {
        //获取所有非空属性，并以json格式返回
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getHostId() != null) {
            sb.append("\"hostId\":\"").append(getHostId()).append("\",");
        }
        if (getInstName() != null) {
            sb.append("\"instName\":\"").append(getInstName()).append("\",");
        }
        if (getCompany() != null) {
            sb.append("\"company\":\"").append(getCompany()).append("\",");
        }
        if (getProdData() != null) {
            sb.append("\"prodData\":\"").append(getProdData()).append("\",");
        }
        if (getType() != null) {
            sb.append("\"type\":\"").append(getType()).append("\",");
        }
        if (getSampleTotal() != null) {
            sb.append("\"sampleTotal\":").append(getSampleTotal()).append(",");
        }
        if (getStatus() != null) {
            sb.append("\"status\":").append(getStatus()).append(",");
        }
        if (getTemperature() != null) {
            sb.append("\"temperature\":\"").append(getTemperature()).append("\",");
        }
        if (getSpin() != null) {
            sb.append("\"spin\":\"").append(getSpin()).append("\",");
        }
        if (getHeLeave() != null) {
            sb.append("\"heLeave\":\"").append(getHeLeave()).append("\",");
        }
        if (getnLeave() != null) {
            sb.append("\"nLeave\":\"").append(getnLeave()).append("\",");
        }
        if (getNotice() != null) {
            sb.append("\"notice\":\"").append(getNotice()).append("\",");
        }
        if (getIsLock() != null) {
            sb.append("\"isLock\":").append(getIsLock()).append(",");
        }
        if (getApproveBy() != null) {
            sb.append("\"approveBy\":\"").append(getApproveBy()).append("\",");
        }
        if (getApproveTime() != null) {
            sb.append("\"approveTime\":\"").append(getApproveTime()).append("\",");
        }
        if (getApproveType() != null) {
            sb.append("\"approveType\":\"").append(getApproveType()).append("\",");
        }
        if (getApproveDetail() != null) {
            sb.append("\"approveDetail\":\"").append(getApproveDetail()).append("\",");
        }
        if (getComment() != null) {
            sb.append("\"comment\":\"").append(getComment()).append("\",");
        }
        // 移除最后一个逗号
        if (sb.length() > 1) {
            sb.setLength(sb.length() - 1);
        }
        sb.append("}");
        return sb.toString();
    }
}
